{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2023-12-06 15:20:48'"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "dateFormat = '%Y-%m-%d %H:%M:%S'\n",
    "d = datetime.now()\n",
    "datetime.strftime(d,dateFormat)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取电池信息\n",
    "import time\n",
    "from androidhelper import Android\n",
    "droid = Android()\n",
    "droid.batteryStartMonitoring()\n",
    "time.sleep(5)\n",
    "bdata = droid.readBatteryData()\n",
    "print(bdata.result)\n",
    "\n",
    "bstatus = droid.batteryGetStatus().result\n",
    "bhealth = droid.batteryGetHealth().result\n",
    "bplug = droid.batteryGetPlugType().result\n",
    "bcheck = droid.batteryCheckPresent().result\n",
    "blevel = droid.batteryGetLevel().result\n",
    "bvoltage = droid.batteryGetVoltage().result\n",
    "btemperature = droid.batteryGetTemperature().result\n",
    "btechnology = droid.batteryGetTechnology().result\n",
    "print(\"电池\",{\"status\": bstatus, \"health\": bhealth, \"plugtype\": bplug, \"checkpresent\": bcheck, \"level\": blevel, \"voltage\": bvoltage, \"temperature\": btemperature, \"technology\": btechnology})\n",
    "\n",
    "droid.batteryStopMonitoring()\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "starEnv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
